#!/usr/bin/env python

import sys

try:
    # py2exe 0.6.4 introduced a replacement modulefinder.
    # This means we have to add package paths there, not to the built-in
    # one.  If this new modulefinder gets integrated into Python, then
    # we might be able to revert this some day.
    # if this doesn't work, try import modulefinder
    try:
        import py2exe.mf as modulefinder
    except ImportError:
        # noinspection PyUnresolvedReferences
        import modulefinder
        # noinspection PyUnresolvedReferences
    import win32com

    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell"]:
        __import__(extra)
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    # no build path setup, no worries.
    pass

from distutils.core import setup

options = {'dll_excludes': ["mswsock.dll", "powrprof.dll"]}
setup(windows=['AnyBackup.py'], options=dict(py2exe=options))